package com.zengqingfa.juc.n3;

import lombok.extern.slf4j.Slf4j;

/**
 * @author zengqingfa
 * @className TestCreateThread1
 * @description
 * @create 2021/6/5 20:45
 */
@Slf4j(topic = "c.TestCreateThread1")
public class TestCreateThread1 {

    public static void main(String[] args) {
        /**
         * 20:59:12 [main] c.TestCreateThread1 - running
         * 20:59:12 [t2] c.TestCreateThread1 - runing...2
         * 20:59:12 [t1] c.TestCreateThread1 - runing...1
         */
        Thread thread1 = new Thread(() -> {
            log.debug("runing...1");
        });
        Thread thread2 = new Thread("t2") {
            @Override
            public void run() {
                log.debug("runing...2");
            }
        };
        thread1.setName("t1");
        thread1.start();
        thread2.start();
        log.debug("running");
    }
}